package com.xiaobai.design_pattern.singleton;

/**
 * @author wangtw
 * @ClassName HungrySingleton
 * @description: 饿汉式单例类
 * @date 2023/6/315:59
 */
public class HungrySingleton {

    private static HungrySingleton hungrySingleton = new HungrySingleton();

    // 构造方法私有，保证外界无法直接实例化
    private HungrySingleton() {
    }

    // 通过该方法获得实例对象
    public static HungrySingleton getInstance() {
        return hungrySingleton;
    }
}
